package com.linrui.car.service.impl;

import com.linrui.car.domain.CarResources;
import com.linrui.car.mapper.CarResourcesMapper;
import com.linrui.car.service.ICarResourcesService;
import com.linrui.basic.service.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wangronggui
 * @since 2022-11-03
 */
@Service
public class CarResourcesServiceImpl extends BaseServiceImpl<CarResources> implements ICarResourcesService {

    @Autowired
    private CarResourcesMapper carResourcesMapper;

    @Override
    @Transactional
    public void addOrUpdate(CarResources carResources) {
        carResourcesMapper.deleteByCarId(carResources.getCarId());
        super.add(carResources);
    }
}
